package com.sam.designpattern.command;

/**
 * @Author: Sam
 * @Date: 2022-08-26 16:14
 * @Description: 运算类，真正实现加减运算
 */
public class Operation implements OperationAPi {

    /**
     * 计算运行的结果
     */
    private int result;

    @Override
    public int getResult() {
        return result;
    }

    @Override
    public void setResult(int result) {
        this.result = result;
    }

    @Override
    public void add(int num) {
        result += num;
    }

    @Override
    public void substract(int num) {
        result -= num;
    }
}
